import Login from "./components/main/Login.vue";
import Main from "./components/main/Main.vue";
import Register from "./components/main/Register.vue";
import Vue from "vue";
import Shopping from "./components/main/Shopping.vue";
import VueRouter from "vue-router";
import Mine from "./components/main/Mine.vue";
import Goods from "./components/main/goods/Goods.vue";
import Account from "./components/main/goods/Account.vue";
import Lease from "./components/main/Lease";

import Cart from "./components/main/mine/Cart";
import Discount from "./components/main/mine/Discount";

import SuccessOrder from "./components/main/order/SuccessOrder";
import FailOrder from "./components/main/order/FailOrder";
import ChangePwd from "./components/main/ChangePwd";
import Discover from "./components/main/Discover";

// house
import HousingList from "./components/main/house/HousingList";
import HouseDetail from "./components/main/house/HouseDetail";

// mine
import HistoryOrder from "./components/main/mine/HistoryOrder";
import Information from "./components/main/mine/Information";
import About from "./components/main/mine/About";
import Address from "./components/main/mine/Address";
import Collection from "./components/main/mine/Collection";
import HouseOrder from "./components/main/mine/HouseOrder";
import Identity from "./components/main/mine/Identity";
import MyHouse from "./components/main/mine/MyHouse";
import Password from "./components/main/mine/Password";
import SeeHouseRequest from "./components/main/mine/SeeHouseRequest";
import Exchange from "./components/main/mine/Exchange";
// 添加收货地址
import AddressAdd from "./components/main/mine/add_address/AddressAdd";

// 我的订单子路由 HouseOrder
import AllOrder from "./components/main/mine/house_order_list/AllOrder";
import Unpaid from "./components/main/mine/house_order_list/Unpaid";
import FinishOrder from "./components/main/mine/house_order_list/FinishOrder";
import AppraiseOrder from "./components/main/mine/house_order_list/AppraiseOrder";
//	---支付订单
import PayOrder from "./components/main/mine/house_order_list/order_pay/PayOrder";
//  ---支付结果
import PayResult from "./components/main/mine/house_order_list/order_pay/PayResult";
//  ---评论订单
import CommentOrder from "./components/main/mine/house_order_list/CommentOrder";

// 我的认证子路由 Identity
import IdCardAuth from "./components/main/mine/id_auth/IdCardAuth";
import StudentAuth from "./components/main/mine/id_auth/StudentAuth";


// 模块的各个地址
Vue.use(VueRouter);
const routers = [{
		path: "/",
		name: "首页",
		component: Main,
		redirect: '/main/discover',
	},
	{
		path: "/login",
		name: "登录",
		component: Login
	},
	{
		path: "/main",
		component: Main,
		redirect: '/main/discover',
		// meta: { requireAuth: true },
		children: [{
				path: "discover",
				component: Discover
			},
			{
				path: "shopping",
				component: Shopping
			},
			{
				path: "mine",
				component: Mine
			},
			{
				path: "lease",
				component: Lease
			},
		]
	},

	//------- house ------
	{
		path: "/housing_list",
		name: "房屋列表",
		component: HousingList,
		meta: {
			pageTitle: '房屋列表',
			keepAlive: true,
		}
	},
	{
		path: "/housing_detail",
		name: "房屋详情",
		component: HouseDetail
	},

	//------------------

	{
		path: "/register",
		name: "注册",
		component: Register
	},

	{
		path: "/changePwd",
		name: "修改密码",
		component: ChangePwd
	},
	{
		path: "/goods/:goods_id",
		name: "商品",
		component: Goods
	},
	{
		path: "/account",
		name: "购买",
		component: Account
	},
	{
		path: "/cart",
		name: "购物车",
		component: Cart
	},
	{
		path: "/discount",
		name: "卡券",
		component: Discount
	},
	{
		path: "/historyOrder",
		name: "历史订单",
		component: HistoryOrder
	},
	{
		path: "/successOrder",
		name: "成功订单",
		component: SuccessOrder
	},
	{
		path: "/failOrder",
		name: "失败订单",
		component: FailOrder
	},
	//---------我的------------
	{
		path: "/mine/collection",
		name: "我的收藏",
		component: Collection
	},

	// 我的订单包含子路由
	{
		path: "/mine/house_order",
		name: "我的订单",
		component: HouseOrder,
		redirect: "/mine/house_order/all_order",
		meta: {
			pageTitle: '我的订单',
			keepAlive: false
		},
		children: [{
				path: "all_order",
				component: AllOrder,
				meta: {
					keepAlive: false,
				}
			},
			{
				path: "check_money_order",
				component: Unpaid,
				meta: {
					keepAlive: false,
				}
			},
			{
				path: "finish_order",
				component: FinishOrder,
				meta: {
					keepAlive: false,
				}
			},
			{
				path: "appraise_order",
				component: AppraiseOrder,
				meta: {
					keepAlive: false,
				}
			},
		]
	},
	{
		path: "/mine/house_order/pay_moneny",
		name: "支付订单",
		component: PayOrder
	},
	{
		path: "/mine/house_order/pay_result",
		name: "支付结果",
		component: PayResult
	},
	{
		path: "/mine/house_order/comment_order",
		name: "评论订单",
		component: CommentOrder
	},
	// 身份认证子路由
	{
		path: "/mine/identity",
		name: "身份认证",
		component: Identity,
		redirect: '/mine/identity/check_id_auth',
		children: [{
				path: "check_id_auth",
				component: IdCardAuth
			},
			{
				path: "check_student_auth",
				component: StudentAuth
			},
		]
	},
	{
		path: "/mine/information",
		name: "我的资料",
		component: Information
	},
	{
		path: "/mine/my_house",
		name: "我的房屋",
		component: MyHouse
	},
	{
		path: "/mine/address",
		name: "收货地址",
		component: Address
	},
	{
		path: "/mine/address/add",
		name: "添加收货地址",
		component: AddressAdd
	},
	{
		path: "/mine/about",
		name: "关于我们",
		component: About
	},
	{
		path: "/mine/change_password",
		name: "修改密码",
		component: Password
	},
	{
		path: "/mine/see_house_request",
		name: "看房请求",
		component: SeeHouseRequest
	},
	{
		path: "/mine/my_exchange",
		name: "我的兑换",
		component: Exchange
	},


	//--------我的-----------
];

export default routers;
